package com.gl.saasservice.sms.controller;


import com.gl.saasservice.sms.service.SmsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * 短信验证码
 *
 * @author shun
 * @createDate: 2021年3月19日 下午7:24:51
 * @version: 1.0
 */
@Controller
@RequestMapping("/sms")
public class SmsController {
    @Autowired
    private SmsService smsService;



    @PostMapping(value = "/code2/{mobile}/{templateId}")
    @ResponseBody
    public String code2(@PathVariable String mobile, @PathVariable String templateId) {
        return smsService.sendTemplateSms(mobile, templateId);
    }

    @PostMapping(value = "/datas")
    @ResponseBody
    public String sendTemplateSmsWithData(@RequestParam(value = "mobile") String mobile,
                                          @RequestParam(value = "templateId") String templateId,
                                          @RequestBody String[] datas) {
        return smsService.sendTemplateSmsWithData(mobile, templateId, datas);
    }

}
